<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>ajax中的XML</title>
    <script src="js/createXMLHttpRequest对象.js"></script>
</head>
<body>
    <button id="btn">请求</button>
    <script>
        var btn = document.getElementById('btn')
        btn.addEventListener('click',function(){
            var xhr = createXMLHttpRequest();
            xhr.onreadystatechange = function(){
                if(xhr.readyState === 200 && xhr.status === 4){
                    //1.接收数据responseXML属性 - 接收XML类型的数据
                    var data = xhr.responseXML;
                    console.log(data)
                    //2.将符合JSON格式的字符串类型数据进行转换
                    // var json = JSON.parse(data);
                    // //3.进行具体处理
                    // console.log(json);
                }
                xhr.open('post','server.xml')
                xhr.send(null)
            }
        })
    </script>
</body>
</html>